<?php
include_once(NUKE_BASE_DIR.'header.php');
include_once("modules/".$module_name."/menu.php");
OpenTable();
global $db, $prefix;
$intcookie = intval($cookie[0]);
	if (!empty($cookie[1])) {
		$sql = "SELECT * FROM ".$user_prefix."_users WHERE user_id='".$intcookie."'";
		$result = $db->sql_query($sql);
		$row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);
		$sender_name = $row['username'];
	}
	
	

//OP ID CHECKEN IS NIET VEILIG, CHECK EERDER OP UNIQUE CODE.
//CHECK ON ID IS NOT SAVE, A USER CAN JUST CHANGE THE ID AND DELETE AN IMAGE OF ANOTHER PERSON, WITH A UNIQUE GENERATED CODE THERE IS NO WAY TO GUESS THE CODE.
$uniquecode = $_GET['uniquecode'];

$sql_image = "SELECT * FROM ".$prefix."_upload WHERE uniquecode='".$uniquecode."'";
$result_image = $db->sql_query($sql_image);
$row_image = $db->sql_fetchrow($result_image);
$db->sql_freeresult($result_image);
$imageowner = $row_image['username'];

//if user pressed yes execute this function which will delete the image
// if user pressed no the return to the images list
//but first check if the user that is logged in is the actual owner of the image he want's to delete
if($sender_name == $imageowner)
{
echo "<div align=\"center\"><h2>"._WANTTODELETE."</h2> <a href=\"modules.php?name=Upload&amp;op=confirm_delete_save&amp;uniquecode=".$uniquecode."\">"._YES."</a> | <a href=\"modules.php?name=Upload&op=yourimages\">"._NO."</a></div>";
}
else
{
	echo "<center><img src=\"modules/".$module_name."/display/warning.png\" title=\""._NOTYOURIMAGE."\" alt=\""._NOTYOURIMAGE."\" border=\"0\" /><br /><h1>"._NOTYOURIMAGE."</h1></center>";
}



CloseTable();
include_once(NUKE_BASE_DIR.'footer.php');
?>